package com.shop.dao.impl;

import com.shop.dao.OrderInfoDao;
import com.shop.dao.base.BaseDao;
import com.shop.entity.OrderInfo;

import java.sql.SQLException;

/**
 * @Description TODO
 * @Author hyl
 * @Date 2022/3/16 11:50
 **/
public class OrderInfoDaoImpl extends BaseDao<OrderInfo> implements OrderInfoDao {
	@Override
	public int add(OrderInfo info){
		String sql = "insert into t_order_info(base_order_id\n" +
				",goods_id\n" +
				",buy_num\n" +
				",amount\n) values(?,?,?,?)";
		Object[] params ={info.getBaseOrderId(),info.getGoodsId(),info.getBuyNum(),info.getAmount()};
		try {
			return super.executeUpdate(sql, params);
		} catch (SQLException throwables) {
			throwables.printStackTrace();
		}
		return 0;
	}
}
